﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IStoreSettings.cs" company="XamlNinja">
//   2011 Richard Griffin and Ollie Riches
// </copyright>
// <summary>
//   The i store settings.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace WP7Contrib.Services.Settings
{
    /// <summary>
    /// The i store settings.
    /// </summary>
    public interface IStoreSettings
    {
        /// <summary>
        /// Attempts to write a setting value.
        /// </summary>
        /// <param name="key">
        /// The key associated with the value
        /// </param>
        /// <param name="value">
        /// The value to be set.
        /// </param>
        /// <typeparam name="T">The type of the value.
        /// </typeparam>
        /// <returns>
        /// Returns the instance of the store settings - fluent interface style.
        /// </returns>
        /// <exception cref="ServiceException">
        /// </exception>
        IStoreSettings Write<T>(string key, T value);

        /// <summary>
        /// Attempts to read a setting value.
        /// </summary>
        /// <param name="key">
        /// The key associated with the value.
        /// </param>
        /// <param name="value">
        /// The value to be stored.
        /// </param>
        /// <typeparam name="T">The type of the value.
        /// </typeparam>
        /// <returns>
        ///  Returns true if the value was read.
        /// </returns>
        /// <exception cref="ServiceException">
        /// </exception>
        bool TryToRead<T>(string key, out T value);
    }
}